package com.qian.apiserver.controller;

import com.qian.apiserver.model.Word;
import com.qian.apiserver.service.IWordService;
import com.yaowk.api.common.PageReq;
import com.yaowk.api.common.PageResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/game/word")
@Api(tags = "屏蔽词功能")
public class WordController {
    @Autowired
    private IWordService wordService;

    @GetMapping("/word")
    @ApiOperation("屏蔽词")
    public PageResp<Word> word(PageReq pageReq){
        return wordService.findAll(pageReq);
    }
    @PostMapping("/save")
    @ApiOperation("添加屏蔽词")
    public void save(Word word){
        wordService.save(word);
    }
    @GetMapping("/delete/{id}")
    @ApiOperation("删除屏蔽词")
    public void delete(@PathVariable Integer id){
        wordService.deleteById(id);
    }
}
